package net.aetherial.context.grounding.gatherers.bots;

import net.aetherial.context.grounding.gatherers.*;
import org.jibble.pircbot.*;

/**
 * IRC bot for logging conversations on IRC channels.
 */

public class IrcBot extends PircBot
{
	private IrcGatherer gatherer;
	
	/**
	 * Sets the gatherer used to pass recorded turns to the rest of the system.
	 * 
	 * @param g	
	 */
	
	public void setGatherer (IrcGatherer g)
	{
		gatherer = g;
	}
	
	/**
	 *	Constructor. Initializes the IRC channel as "gabby". 
	 */
	
	public IrcBot ()
	{
		this.setName ("gabby");
	}
	
    /**
     * Processes an incoming message by sending it to the rest of the system.
     * 
     * @see org.jibble.pircbot.PircBot#onMessage(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
     */
	
    public void onMessage (String channel, String sender, String login, String hostname, String message) 
    {
    	if (gatherer != null)
    		gatherer.process (sender,  message, 0.0);
    }
}
